<template>
  <!-- 设备运行状态 -->
  <div class="runningState">
    <div class="title text-shadow">设备运行状态</div>
    <div class="list">
      <div class="item" v-for="(item, index) in equipmentList" :key="index">
        <div class="item-inner">
          <div class="name">
            <el-tooltip effect="light" :content="item.name" placement="top">
              <p>{{ item.equipmentName ? item.equipmentName : "XXX" }}</p>
            </el-tooltip>
            <div class="angle angle_top_right"></div>
            <div class="angle angle_top_left"></div>
            <div class="angle angle_bottom_right"></div>
            <div class="angle angle_bottom_left"></div>
          </div>
          <div class="code info">
            <p class="label">编号</p>
            <p class="value">{{ item.equipmentCode }}</p>
          </div>
          <div class="state info">
            <p class="label">状态</p>
            <p class="value" v-if="item.type == 1">运行</p>
            <p class="value" style="color: #999" v-if="item.type == 0">空闲</p>
          </div>
        </div>
        <div class="angle angle_top_right">
          <div class="dot"></div>
        </div>
        <div class="angle angle_top_left">
          <div class="dot"></div>
        </div>
        <div class="angle angle_bottom_right">
          <div class="dot"></div>
        </div>
        <div class="angle angle_bottom_left">
          <div class="dot"></div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'runningState',
  data () {
    return {
      equipmentList: []
    }
  },
  mounted () {
    this.getList()
  },
  methods: {
    async getList () {
      let { data } = await this.$API.produce.equipment.getEquipmentList.get()
      this.equipmentList = data
    }
  }
}
</script>
<style lang="scss" scoped>
@font-face {
  font-family: "LcdD";
  src: url("@/assets//fonts/LcdD.TTF") format("truetype");
}
.list {
  display: flex;
  margin-top: 30px;
}
.item {
  position: relative;
  width: 160px;
  height: 180px;
  padding: 2px;
  margin-right: 50px;
  margin-left: 10px;
  border: 2px #004dc0 solid;
  &:last-child {
    margin-right: 0;
  }
}
.item-inner {
  width: 100%;
  height: 100%;
  padding: 25px 15px 0 15px;
  background: linear-gradient(
    to bottom,
    rgba(0, 77, 192, 0.5) 20%,
    rgba(2, 62, 112, 0.2) 70%
  );
  .name {
    position: relative;
    text-align: center;
    padding: 8px;
    margin-bottom: 20px;
    font-size: 18px;
    text-shadow: 3px 3px 7px rgba(0, 46, 208, 0.5);
    background-color: #000926;
    P {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .angle_top_right {
      top: -2px;
      right: -2px;
    }
    .angle_top_left {
      top: -2px;
      left: -2px;
    }
    .angle_bottom_right {
      bottom: -2px;
      right: -2px;
    }
    .angle_bottom_left {
      bottom: -2px;
      left: -2px;
    }
  }
  .info {
    display: flex;
    justify-content: space-between;
    line-height: 2em;
    font-size: 18px;
  }
  .label {
    white-space: nowrap;
  }
  .code {
    .value {
      font-family: "LcdD", sans-serif;
      letter-spacing: 3px;
      // font-weight: 600;
      font-size: 20px;
      color: #18f5fa;
    }
  }
  .state {
    .value {
      color: #13f62a;
    }
  }
}

.angle {
  position: absolute;
  display: flex;
  width: 8px;
  height: 8px;
  align-items: center;
  justify-content: center;
  .dot {
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background-color: #51e0ff;
  }
}
.angle_top_right {
  top: -10px;
  right: -8px;
  border-right: 2px #51e0ff solid;
  border-top: 2px #51e0ff solid;
}
.angle_top_left {
  top: -10px;
  left: -8px;
  border-left: 2px #51e0ff solid;
  border-top: 2px #51e0ff solid;
}
.angle_bottom_right {
  bottom: -10px;
  right: -8px;
  border-right: 2px #51e0ff solid;
  border-bottom: 2px #51e0ff solid;
}
.angle_bottom_left {
  bottom: -10px;
  left: -8px;
  border-left: 2px #51e0ff solid;
  border-bottom: 2px #51e0ff solid;
}
</style>